<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ taglib prefix="limits" uri="/WEB-INF/tld/limits.tld"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>虚拟频道素材列表页</title>
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/defalut.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/public.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/ddspstyle.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/icon.css">

<script type="text/javascript" src="../../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../../static/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../static/js/index.js"></script>
<%
	String f_vcm_type = request.getParameter("type");
%>
<script type="text/javascript">
		var queryParams;
		function EasyuiDatagrid() {
			//alert('liebiao chax');
			$("#easyui-datagrid").datagrid({
				url: '../../content/content_list.do',
				nowrap: true,
				striped: true,
				border: false,
				fit: true,
				rownumbers:true,
				queryParams: getGueryParams(),
				columns: [[
					{field:'id',checkbox:true},
					{field:'f_cc_id',title:'内容ID',align:'center',width:50},
					{field:'f_cc_name',title:'内容名称',align:'center',width:150},
					{field:'f_cc_duration',title:'时长',align:'center',width:150},
					{field:'f_cc_code',title:'路径',align:'center',width:150},
					{field:'_parentId',title:'操作',align:'center',width:450,
						formatter:function(value,row,index){
							var str = "";
							str= "<a class='easyui-linkbutton l-btn l-btn-plain' iconCls='icon-ok' href='javascript:void(0);' plain='true' onclick='onClickBtnSelect("+row.f_cc_id+");' ><span class='l-btn-left'><span class='l-btn-text icon-remove l-btn-icon-left'>选择</span></span></a>";
							return str;
				    	}
					}
				]],
				singleSelect:false,
				pagination:true,
				pageList:[10,20,30,40,50],
				pageSize:10,
				toolbar: '#toolbar',
				
				onExpandRow: function(index,row){
				
				},
				onSelect: function(rowIndex,rowData) {
					
				},
				onUnselect: function(rowIndex,rowData) {
					
				},
				onCheckAll: function(rowIndex,rowData) {
					
				},
				onUncheckAll: function(rowIndex,rowData) {
				
				},
				onLoadSuccess: function(data) {
					if(data.total==-1) {
						$.messager.defaults={ok:"确定",cancel:"取消"};
						$.messager.confirm('提示', '用户尚未登录,请登录', function(r){
						if (r){
						    window.parent.location.href='/login.do';
						    return false;
						}});
					}
				}
			});
		}
	
		function getGueryParams(){
			return {
				f_cc_name:$("#f_cc_name").val(),
				f_cc_status:1,
				f_cc_type:2,
				f_cc_companyid:$("#f_cc_companyid").val()
			};
		}
		
		$(function(){
			$.ajax({
				url:"../../pms/industry_orgVo_list.do?page=1&rows=1000",//../../pms/org_list.do
				success:function(data) {
					data = JSON.parse(data);
					data =data.rows;
					var str = "";
					for(var i=0;i<data.length;i++) {
						str+='<option value="'+data[i].f_po_id+'">'+data[i].f_po_name+'</option>';
					}
					$("#f_cc_companyid").append(str);
					
					$("#orgSpan").append($("#f_cc_companyid").clone(true));
				}
			});
			new EasyuiDatagrid();
			gotoSearch = function(){
				$("#easyui-datagrid").datagrid('reload',getGueryParams());
			};
			
			$("#chooseOption1").on("change", function(){
				if($(this).val() == 1){
					$("#chooseOption2").show();
				} else {
					$("#chooseOption2").hide();
				}
			});
			
			
		});
		
		function onClickBtnSelect(param){
			window.parent.f_cc_id = param;
			window.parent.f_vcm_type = "<%=f_vcm_type%>";
			window.parent.dialog_close();
			return false;
		}
		function SubgridTabOnSelect(title,index){
			setTimeout(function(){
				$("#easyui-datagrid").datagrid('fixDetailRowHeight',index);
			},300);
			setTimeout(function(){
				$("#easyui-datagrid").datagrid('fixDetailRowHeight',index);
			},3000);
	    }
		
		function load(){
			$(".datagrid-row-expander datagrid-row-expand").attr("display","none"); 
		}
		
		function onpress(){
			var event=arguments.callee.caller.arguments[0]||window.event;//消除浏览器差异
	   		  	if (event.keyCode == 13){  
	      			gotoSearch($('#easyui-treegrid'));
	    		}
		}
		function bind(id) {
			openDialog($('#org_list'),'../behavior_control/org_update.jsp?idField=f_cc_companyid&nameField=f_cc_company_name');
		}
		function resert(){
			$("#f_cc_company_name").val("");
			$("#f_cc_companyid").val("");
		}
	</script>
</head>
<body onload="load();" style="width: 100%;">
	<input type="hidden" id="sessionId" value="${pageContext.session.id}" />
	<table id="easyui-datagrid" title="内容列表"></table>
	<div id="toolbar" class="easyui_datagrid_toolbar" style="">
		<div class="easyuiSearch">
			<form onsubmit="return false;" method="post">
				<table cellspacing="0" cellpadding="0" width="90%">
					<tr>
						<td align="left" width="7%">内容名称：</td>
						<td align="left" width="15%"><input name="f_cc_name" id="f_cc_name" style="width: 150px;" onkeydown="onpress();" /></td>
						<td align="left" width="7%"><!-- 内容状态： --></td>
						<td align="left" width="10%">
							<!-- <select id="f_cc_status" name="f_cc_status">
									<option value="0">请选择</option>
									<option value="1">上线</option>
									<option value="2">待上线</option>
									<option value="5">待转码</option>
									<option value="6">正在转码</option>
									<option value="7">转码失败</option>
									<option value="8">等待资源</option>
									<option value="9">资源缺失</option>
									<option value="10">资源格式/容量不正确</option>
									<option value="11">待处理</option>
									<option value="12">不通过</option>
							</select> -->
						</td>
					</tr>
					<tr>
						<td  align="left" width="10%">
							行业客户:
						</td>
						<td align="left" width="30%">
							<input name="f_cc_company_name" id="f_cc_company_name" readonly="readonly"	style="width: 150px;" value="" class="yl_inp yw_name" />
							<input name="f_cc_companyid" id="f_cc_companyid" type="hidden" value="" />  
							<input name="status" id="status" type="hidden" value="nochange" />  
							<!-- <select id="f_cc_companyid" name="f_cc_companyid" style="width: 150px;">
							</select> -->
							<!-- <span id="f_cc_companyid_tip" class="tip"></span> -->
							<a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);" onclick="resert()">空选</a>
							<a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
								onclick="bind();">选择</a>
						</td>
						<td align="left" width="15%">
							<limits:uiAuth url="content_list.do">
								<a href="javascript:void(0);" class="easyui-linkbutton"
									data-options="iconCls:'icon-search', plain:true"
									onclick="gotoSearch($('#easyui-datagrid'))">查询</a>
							</limits:uiAuth>
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
	<div id="org_list" class="easyui-dialog"
		style="width: 800px; height: 500px; padding-top: 0px;"
		data-options="title:'客户选择', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
</body>
</html>